/*
 * @Author: zhangyang
 * @Date: 2021-11-14 14:44:45
 * @LastEditTime: 2021-11-14 17:44:01
 * @Description: 默认配置
 */
/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1636517066275_1809';

  // add your middleware config here
  config.middleware = ['auth'];

  /**
   *  关于 session 的配置
   */
  config.session = {
    key: 'BluesYoung-web',
    // 仅服务端可修改
    httpOnly: true,
    // 加密
    encrypt: true,
    // 无操作 30 分钟之后过期
    maxAge: 30 * 60 * 1000,
    renew: true
  };

  /**
   *  默认数据库配置
   */
  config.sequelize = {
    dialect: 'mysql',
    host: '192.168.31.216',
    port: 3306,
    username: 'root',
    password: 'my-secret-pw',
    database: 'egg_admin_dev',
  };

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
